﻿CREATE TABLE [dbo].[user_User] (
    [UserId]       UNIQUEIDENTIFIER CONSTRAINT [DF_User_UserId] DEFAULT (newid()) NOT NULL,
    [Email]        NVARCHAR (256)   NOT NULL,
    [PasswordHash] NVARCHAR (128)   NOT NULL,
    [PasswordSalt] NVARCHAR (128)   NOT NULL,
    [HashCode]     NVARCHAR (32)    NOT NULL,
    [CreateDate]   DATETIME         CONSTRAINT [DF_User_CreateDate] DEFAULT (getdate()) NOT NULL,
    [ActivityDate] DATETIME         NOT NULL,
    [IsIdentify]   BIT              CONSTRAINT [DF_user_User_IsIdentify] DEFAULT ((0)) NOT NULL,
    [NickName] NVARCHAR(12) NULL, 
		[EmailSh1]     VARCHAR (32)     NOT NULL,
    CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED ([UserId] ASC),
    CONSTRAINT [IX_User_Email] UNIQUE NONCLUSTERED ([Email] ASC),
    CONSTRAINT [IX_User_HashCode] UNIQUE NONCLUSTERED ([HashCode] ASC), 
    CONSTRAINT [IX_User_EmailSh1] UNIQUE NONCLUSTERED ([EmailSh1] ASC)
);


GO
CREATE NONCLUSTERED INDEX [IX_User]
    ON [dbo].[user_User]([Email] ASC);

